/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Regex pattern
 * @author Hung Cuong <nhc.hcmuns at gmail.com>
 */
public class RegexPattern {
    
    /**
     * Is valid email
     * @param input
     * @return
     */
    public static Boolean IsValidEmail(String input) {

        // regex for email
        Pattern pattern = Pattern.compile("^([a-zA-Z0-9_\\.\\-\\+])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$");
        Matcher matcher = pattern.matcher(input);

        // matched ?
        while(matcher.find()) {
            return true;
        }

        return false;
    }
}
